import request from '@/router/axios'

export function fetchSchoolList(query) {
  return request({
    url: '/pvm/school/page',
    method: 'get',
    params: query
  })
}

export function addObj(obj) {
  return request({
    url: '/pvm/school',
    method: 'post',
    data: obj
  })
}

export function getSchoolObj(id) {
  return request({
    url: '/pvm/school/' + id,
    method: 'get'
  })
}

export function getByschoolName(schoolName) {
  return request({
    url: '/pvm/school/schoolName/' + schoolName,
    method: 'get'
  })
}

export function delObj(id) {
  return request({
    url: '/pvm/school/' + id,
    method: 'delete'
  })
}

export function putObj(obj) {
  return request({
    url: '/pvm/school',
    method: 'put',
    data: obj
  })
}


export function changeSchoolStatus(id,status) {
  return request({
    url: '/pvm/school/'+id+'/'+status,
    method: 'get',
  })
}


export function getSchoolList(query) {
  return request({
    url: '/pvm/school/getSchoolList',
    method: 'get',
    params: query
  })
}

export function getSchoolOptions(obj) {
  return request({
    url: '/pvm/school/list',
    method: 'get',
    params: obj
  })
}

export function getSchoolDeptList(schoolId) {
  return request({
    url: '/pvm/dept/getList/' + schoolId,
    method: 'get',
  })
}


// 查询学校年级班级列表
export function getClassOptions(schoolId,gradeId) {
  return request({
    url: '/pvm/class/getClassList/' + schoolId + '/' + gradeId,
    method: 'get',
  })
}

export function syncSchool() {
  return request({
    url: '/pvm/school/syncSchool',
    method: 'get',
  })
}

export function getSchoolListBySchoolType(schoolType) {
  return request({
    url: '/pvm/school/getSchoolList/' + schoolType,
    method: 'get',
  })
}

export function getStudentByArea() {
  return request({
    url: '/pvm/school/getStudentByArea',
    method: 'post',
  })
}
